package com.santos.hw.component;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

public class main {

    public static void main(String[] args)
    {
        ApplicationContext applicationContext = new FileSystemXmlApplicationContext("/src/main/resources/beans.xml");

        StudentAction studentaction = applicationContext.getBean("studentactionid", StudentAction.class);
        studentaction.execute();
        System.out.println(studentaction);

        // 实现多例： 在需要实现的类上面加 @Scope("prototype")
        StudentAction studentaction2 = applicationContext.getBean("studentactionid", StudentAction.class);
        studentaction2.execute();
        System.out.println(studentaction2);

        ((FileSystemXmlApplicationContext) applicationContext).close();
    }
}
